<?php

namespace app\common\model;

use think\Model;

/**
 * 文章
 */
class Card Extends Model
{

    // 表名
    protected $name = 'card';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'datetime';
    protected $dateFormat = 'Y-m-d H:i:s';

    // 定义时间戳字段名
    protected $createTime = 'create_dt';
    protected $updateTime = 'update_dt';
    protected $deleteTime = false;
    // 追加属性
    protected $append = [
        'img_url'
    ];


    public function getImgUrlAttr($value, $data)
    {
        return config('upload_domain').$data['img'];
    }


    public function admin()
    {
        return $this->belongsTo('\app\admin\model\Admin', 'salesman_admin_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
